﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace Site.Secure
{
    public partial class Overview : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlDataSource1.SelectCommand = "SELECT SiteID FROM Sites";
            DataView View = (DataView)SqlDataSource1.Select(new DataSourceSelectArguments());
            tvOverview.Nodes.Clear();
            foreach (DataRowView DRV in View)
            {
                TreeNode Node = new TreeNode();
                Node.Expanded = false;
                Node.Text = DRV["SiteID"].ToString();
                SqlDataSource1.SelectCommand = "SELECT * FROM Hives WHERE SiteID='" + DRV["SiteID"] + "'";
                DataView DV = (DataView)SqlDataSource1.Select(new DataSourceSelectArguments());
                foreach (DataRowView drv in DV)
                {
                    Node.ChildNodes.Add(new TreeNode(drv["Barcode"].ToString()));
                }

                tvOverview.Nodes.Add(Node);
            }
        }

        protected void tvOverview_SelectedNodeChanged(object sender, EventArgs e)
        {

        }
    }
}